/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rentalmobil.entity;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import rentalmobil.koneksidatabase.koneksiDataBase;

/**
 *
 * @author User
 */
public class Manager {

    private String nama;
    private String password;
    private String akses;

    public Manager() {
    }

    public Manager(String nama, String password) {
        this.nama = nama;
        this.password = password;
    }

    public String getNama() {
        return nama;
    }

    public void setNama(String nama) {
        this.nama = nama;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getAkses() {
        return akses;
    }

    public void setAkses(String akses) {
        this.akses = akses;
    }

    public boolean managerLogin(String namaManager) throws SQLException {
        Statement st = koneksiDataBase.getConnection().createStatement();
        ResultSet rs = st.executeQuery("select namaManager, passwordManager,akses from akunManager where namaManager='" + namaManager + "';");
        while (rs.next()) {
            setNama(rs.getString("namaManager"));
            setPassword(rs.getString("passwordManager"));
            setAkses(rs.getString("akses"));
        }
        return true;
    }
}


